<?php
    session_start();
    require_once '../includes/runtime/lib/Propel.php';
    Propel::init("../includes/build/conf/easylib-conf.php");
    set_include_path("../includes/build/classes" . PATH_SEPARATOR . get_include_path());
    $resultat=null;
    $param=$_GET['id'];
    $mail=$_GET['email'];
    $abonne= TabAbonneQuery::create()->filterByEmail($mail)->findOne();
    $utilisation = TabUtilisationQuery::create()->filterByFkAbonne($abonne->getIdAbonne())->filterByDateFin(null)->find();
    $station = TabStationQuery::create()->filterByIdStation($param)->findOne();
    $infostation=  TabInformationStationQuery::create()->filterByFkStation($station->getIdStation())->orderByLastUpdate(Criteria::DESC)->findOne();
    $resultat['AvailableBikes']=$infostation->getAvailableBikes();
    $resultat['AvailableBikeStands']=$infostation->getAvailableBikeStands();
    //if($resultat==null){
      //  $resultat=0;
    //}
    echo json_encode($resultat);  
?>
